<template>
  <div class="PerSonal">
    <InputBox :inputProps="timesInput" />
    <SelectPick :selectProps="identityPick" />
  </div>
</template>

<script lang="ts" setup>
import { IgetDetailByNoticeSerialNo } from '@/typings/getDetailByNoticeSerialNo';
import { commonTypes } from '@/typings/commonTypes';
import SelectPick from './SelectPick.vue';
import InputBox from './InputBox.vue';

import { Cell, CellGroup, Dialog, Step, Steps, Form, Field } from 'vant';
import type { FormInstance } from 'vant';

import { useStore } from 'vuex';
const store = useStore();
//因为这里用了script的setup方式就用不到 defineComponent 这个定义组件的api了
import {
  useSlots,
  useAttrs,
  defineProps,
  onMounted,
  watchEffect,
  ref,
  reactive,
  PropType,
  watch,
  computed,
} from 'vue';

const timesInput: commonTypes.IselectProps = reactive({
  name: 'times',
  label: '住院次数',
  required: true,
  maxlength: 2,
  inputType: 'digit',
  keyOne: 'patAdmiNote',
  keyTwo: 'times',
});

const identityPick: commonTypes.IselectProps = reactive({
  name: 'identity',
  label: '住院身份',
  required: true,
  columns: computed(() => store.getters.getDictionaries).value.identity,
  keyOne: 'patAdmiNote',
  keyTwo: 'identity',
});

//获取父组件传的值
/*const props = defineProps({
  formPam: {
    // type:  Array as () => Array<string>, //(string也可以是其他你自定义的接口)
    type: Object as PropType<IgetDetailByNoticeSerialNo.IRootObject>,
    required: true,
    default: () => {
      return {};
    },
  },
});*/

//初始化赋值
const init = () => {
  const form = computed((): IgetDetailByNoticeSerialNo.BusObj => store.getters.form);
  //console.log('init', admissionNumInput.value);
};

onMounted(() => {
  //console.log('onMounted:', PerSonal.docAdmiNote?.admissionNum);
});

// 1.监听对象 赋值
watch(
  () => store.state.form, //props.formPam,
  () => {
    init();
  },
  {
    deep: true, // 深度监听的参数
    immediate: true, //绑定值就开始执行监听
  },
);

//watchEffect 会最先执行
watchEffect(() => {
  //console.log('watchEffect:', 3333);
});
</script>

<style scoped lang="scss">
.PerSonal {
}
</style>
